Overview of make

Contents|Index|Next
Overview of make

The make utility automatically determines which pieces of a large program need to be recompiled, and then issues commands to recompile them. This documentation describes GNU make, a program which was implemented by Richard Stallman and Roland McGrath. GNU make conforms to section 6.2 of IEEE Standard 1003.2-1992 (POSIX.2).

Our examples show C programs, since they are most common, but you can use make with any programming language whose compiler can be run with a shell command. Indeed, make is not limited to programs. You can use it to describe any task where some files must be updated automatically from others whenever the others change.

To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program and provides commands for updating each file. In a program, typically, the executable file is updated from object files, which are in turn made by compiling source files.

Once a suitable makefile exists, each time you change some source files, the following shell command is the only requirement in order to perform all necessary recompilations.

make

The make program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the data base.

You can provide command line arguments to make to control how and which files should be recompiled. See How to run make.

See also How to read this documentation and Problems and bugs.

Top|Contents|Index|Next